// Base64 测试用例
import { base64Encode,base64Decode } from "./base64";

function testBase64() {
  const testCases = [
    { input: 'hello', desc: '普通英文' },
    { input: '你好', desc: '中文' },
    { input: '1234567890', desc: '数字' },
    { input: 'hello, 世界!', desc: '中英文混合' },
    { input: '特殊字符!@#$%^&*()', desc: '特殊字符' },
    { input: '', desc: '空字符串' },
  ];

  testCases.forEach(({ input, desc }) => {
    const encoded = base64Encode(input);
    const decoded = base64Decode(encoded);
    console.log(`【${desc}】原文: ${input}`);
    console.log(`编码: ${encoded}`);
    console.log(`解码: ${decoded}`);
    console.log(`测试${decoded === input ? '通过' : '失败'}\n`);
  });
}

testBase64();
